{% if logic_controller.logic_controller_type in [LOGIC_CONTROLLER_TYPE.IF_CONTROLLER, LOGIC_CONTROLLER_TYPE.WHILE_CONTROLLER, LOGIC_CONTROLLER_TYPE.LOOP_CONTROLLER, LOGIC_CONTROLLER_TYPE.SIMPLE_CONTROLLER] %}
  {% set logic_controller_badge = '' %}
  {% if logic_controller.logic_controller_type == LOGIC_CONTROLLER_TYPE.IF_CONTROLLER %}
    {% set logic_controller_badge = 'IF' %}
  {% elif logic_controller.logic_controller_type == LOGIC_CONTROLLER_TYPE.WHILE_CONTROLLER %}
    {% set logic_controller_badge = 'WHILE' %}
  {% elif logic_controller.logic_controller_type == LOGIC_CONTROLLER_TYPE.LOOP_CONTROLLER %}
    {% set logic_controller_badge = 'LOOP' %}
  {% elif logic_controller.logic_controller_type == LOGIC_CONTROLLER_TYPE.SIMPLE_CONTROLLER %}
    {% set logic_controller_badge = 'SIMPLE' %}
  {% endif %}
  <div class="card logic-controller" data-logic-controller-id="{{ logic_controller.id }}" data-id="LOGIC_CONTROLLER-{{ logic_controller.id }}">
    <div class="card-header specific-logic-controller d-flex p-0" data-logic-controller-id="{{ logic_controller.id }}">
      <a class="btn btn-link btn-fold" type="button" data-toggle="collapse" data-target="#collapse-scene-{{ logic_controller.id }}" onclick="changeBtnCollapseIcon(this)"></a>
      <span class="badge badge-pill badge-secondary logic-controller-type align-self-center cursor-pointer {{ 'div-forbidden' if is_forbidden(logic_controller) }}"> {{ logic_controller_badge }} </span>
      <div class="logic-controller-content cursor-pointer pl-1 {{ 'div-forbidden' if is_forbidden(logic_controller) }}" data-logic-controller-id="{{ logic_controller.id }}">
        <small class="logic-controller-content-name">{{ logic_controller.name }}</small>
        <small class="logic-controller-content-expression">{{ logic_controller.specific_controller.expression }}</small>
      </div>
      <a class="btn btn-link btn-logic-controller float-right" type="button"></a>
      <div class="btn-logic-controller-tippy-content" data-logic-controller-id="{{ logic_controller.id }}" style="display: none">
        <button type="button" class="btn btn-sm btn-outline-primary btn-block mt-0 border-0" onclick="deleteLogicController({{ logic_controller.id }})">删除</button>
        <button type="button" class="btn btn-sm btn-outline-primary btn-block mt-0 border-0" data-logic-controller-id="{{ logic_controller.id }}" onclick="copyLogicControllerSelf(this)" >复制</button>
        <button type="button" class="btn btn-sm btn-outline-primary btn-block mt-0 border-0" onclick="forbiddenLogicController({{ logic_controller.id }})">禁用/启用</button>
      </div>
    </div>
    <div id="collapse-scene-{{ logic_controller.id }}" class="collapse show">
      <div class="card-body list-group nested-sortable pl-1 pt-1 pb-1 pr-0" data-logic-controller-id="{{ logic_controller.id }}">
        {% if include_single_logic_controller_type == 'recursive' %}
          {# 通过页面加载导入逻辑控制器时，配合上层for循环进行递归遍历加载#}
          {{ loop(sort_by_order_in_logic_controller(nested_logic_controller_id)) }}
        {% elif include_single_logic_controller_type == 'copy' %}
          {# 通过复制方式，加载该逻辑控制器下所有组件 #}
          {% include 'scene/_nested_logic_controller.html' %}
        {% elif include_single_logic_controller_type == 'add' %}
          {# 新增逻辑控制器，默认控制器内组件未空 #}
        {% endif %}
      </div>
    </div>
  </div>
{% endif %}
